# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-test-unit-rr
_gemname=test-unit-rr
pkgver=1.0.5
pkgrel=2
pkgdesc="RR adapter for test-unit"
url="https://github.com/test-unit/test-unit-rr"
arch="noarch"
license="LGPL-2.0-or-later"
depends="ruby ruby-rr"
checkdepends="ruby-test-unit"
makedepends="ruby-rdoc"
subpackages="$pkgname-doc"
source="https://github.com/test-unit/test-unit-rr/archive/$pkgver/$_gemname-$pkgver.tar.gz
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

build() {
	gem build $_gemname.gemspec
}

check() {
	ruby test/run-test.rb
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--document ri \
		--verbose \
		$_gemname

	# Remove unnessecary files
	cd "$gemdir"
	rm -rf build_info cache extensions plugins
}

doc() {
	pkgdesc="$pkgdesc (ri docs)"

	amove "$(ruby -e 'puts Gem.default_dir')"/doc
}

sha512sums="
f91e9d9c041b84c4eed80850c3d5e3567c7082d1a6643b6ffb4e3464184ed703f9e8f03a2f2cbd4acc7d9cb7ded3d60fe9db4d08ed19c7daf91d46a410d6c29a  test-unit-rr-1.0.5.tar.gz
ea137126afec2aa750a6e1bfd73a0fb19acae84e2b415e78b2519c3cbfbe899169c295ee418df9319640238d651e1fe22cf3cfd59d00b9ad7502382b3ef41828  gemspec.patch
"
